package cn.flc.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class VerifyUtils{
    /**
     * 手机号验证
     * @author ：shijing
     * @param  str
     * @return 验证通过返回true
     */
    public static boolean isMobile(String str) {
        boolean b = false;
        Integer phone= null;
        try {
            //判断手机号是否为英文
            if(str!=null){
                //防止超上线
                Long timeLong = Long.parseLong(str )/1000;
                Integer timeInt = timeLong.intValue();
                phone = Integer.valueOf(timeInt);
            }
            if(phone!=null){
                Pattern p = null;
                Matcher m = null;
                p = Pattern.compile("^[1][3,4,5,7,8][0-9]{9}$"); // 验证手机号
                m = p.matcher(str);
                b = m.matches();
                return b;
            }
        } catch (NumberFormatException e) {
            e.printStackTrace();
        }
        return b;

    }
    public static boolean isEmail(String str) {
        if(str.endsWith("@qq.com")||str.endsWith("@QQ.com")){
            return true;
        }
        return false;
    }

}
